package com.hjb.controller;

import com.hjb.common.Response;
import com.hjb.service.UserLogService;
import com.hjb.vo.UserLogVO;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author HuJiaBing
 * @date 2025/6/28 9:59
 */
@RestController
@RequestMapping("/userLog")
public class UserLogController {
    @Resource
    private UserLogService userLogService;

    @RequestMapping("/list")
    public Response<List<UserLogVO>> getAllUserLog() {
        return Response.success(userLogService.getAllUserLog());
    }

    @PostMapping("/save")
    public Response<List<UserLogVO>> saveUserLog() {
        userLogService.saveAll();
        return Response.success();
    }
    @PostMapping("/saveWithTransactional")
    public Response<List<UserLogVO>> saveUserLogWithTransactional() {
        userLogService.saveAllWithTransaction();
        return Response.success();
    }

}
